﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
	<head>
	<base href="<%=basePath%>">
	<meta charset="utf-8" />
	<link type="text/css" rel="stylesheet" href="<%=basePath %>static/js/zTree/zTreeStyle.css"/>
	<jsp:include page="../inc/bootstrap.jsp"></jsp:include>
	<script type="text/javascript" src="<%=basePath %>static/js/zTree/jquery.ztree-2.6.min.js"></script>
<body>
<input type="hidden" id="permission_ztree" value="1">
<div class="mainLay">	
	<table id="tableTree" style="width:100%;height:100%;">
		<tr>
			<td style="width:15%;vertical-align: top!important;" >
				<div style="width:100%;height:100%;overflow:auto;" id="leftTreeBox">
					<ul id="leftTree" class="tree"></ul>
				</div>
			</td>
			<td style="width:85%;height:100%;vertical-align: top!important;" >
				<iframe name="treeFrame" id="treeFrame" frameborder="0" src="<%=basePath%>permissionController/findPermissionListByParentid.do?parentId=${parentId}" style="margin:0 auto;width:100%;height:100%;"></iframe>
			</td>
		</tr>
	</table>
</div>	


<script type="text/javascript">
		/* $(top.hangge()); */
		var zTree;
		$(document).ready(function(){
			var setting = {
			    showLine: true,
			    checkable: false
			};
			var zn = '${zTreeNodes}';
			var zTreeNodes = eval(zn);
			zTree = $("#leftTree").zTree(setting, zTreeNodes);
			treeFrameT();
			
			var permissionZtreeId = getCookieValue("permissionZtreeId");
			if(permissionZtreeId){
				zTree.expandNode(zTree.getNodeByTId(permissionZtreeId), true, false);
				/* $("#"+permissionZtreeId+"_span").click(); */
			}
			$("body").on("click","#leftTree li>a",function(){
				var id = $(this).parents("li").attr("id"); 
				var href = $(this).attr("href"); 
				var selectedNode = zTree.getNodeByTId(id);
				setCookie("permissionZtreeId",id,"","")
			});

		});
		
		function treeFrameT(){
			document.getElementById("leftTreeBox") .style.height = (top.iframe_h-12) + 'px';
			document.getElementById("treeFrame") .style.height = (top.iframe_h-12) + 'px';
		}
		
		window.onresize=function(){  
			treeFrameT();
		};
	
</script>
</body>
</html>

